#! /bin/sh
#
# susan       This shell script takes care of starting and stopping
#	       the susan Storage daemon.
#
# chkconfig: 2345 90 9
# description: Backup Archiving REcovery Open Sourced.
#
# Copyright (C) 2011 Hechzh Property
# Modified to work on SuSE 1/31/2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
# Added rc.status functions 3/13/2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
# Added LSB init info 10/14/2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
# Added $remote_fs, add susan specific daemon user & group Bruno Friedmann <bruno@ioda-net.ch>
#
### BEGIN INIT INFO
# Provides:			susan-sd
# Required-Start:		$local_fs $remote_fs $network $time $syslog
# Required-Stop:		$local_fs $remote_fs $network $time $syslog
# Default-Start:		3 5
# Default-Stop: 	0 1 2 6
# Short-Description:	susan storage daemon
# Description:			Susan network backup system storage daemon
### END INIT INFO

# source process status functions
# this gives us funtion rc_status -v to tell us if we succeed or fail
. /etc/rc.status

case "$1" in
    start)
       echo -n "Starting the Susan Storage daemon: "
       /sbin/startproc -u @sd_user@ -g @sd_group@ @sbindir@/susan-sd $2
       rc_status -v && touch @subsysdir@/susan-sd
       ;;
    stop)
       echo -n "Stopping the Susan Storage daemon: "
       /sbin/killproc @sbindir@/susan-sd
       rc_status -v && rm -f @subsysdir@/susan-sd
       ;;
    restart)
       $0 stop
       sleep 5
       $0 start
       ;;
    status)
       echo -n "Checking for Susan storage daemon "
       /sbin/checkproc @sbindir@/susan-sd
       rc_status -v
       ;;
    *)
       echo "Usage: $0 {start|stop|restart|status}"
       exit 1
       ;;
esac
rc_exit
